.class public final Les/m9;
.super Ljava/lang/Object;
.source "BufferAllocator.java"


# instance fields
.field private final a:I

.field private volatile b:I

.field private c:[Lcom/esfile/screen/recorder/media/util/l;

.field private final d:I

.field private e:I

.field private f:Lcom/esfile/screen/recorder/media/util/m;


# direct methods
.method public constructor <init>(I)V
    .locals 1

    const/4 v0, 0x0

    .line 1
    invoke-direct {p0, p1, v0}, Les/m9;-><init>(II)V

    return-void
.end method

.method public constructor <init>(II)V
    .locals 3

    .line 2
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    const/4 v0, 0x0

    .line 3
    iput v0, p0, Les/m9;->e:I

    .line 4
    new-instance v1, Les/m9$a;

    invoke-direct {v1, p0}, Les/m9$a;-><init>(Les/m9;)V

    iput-object v1, p0, Les/m9;->f:Lcom/esfile/screen/recorder/media/util/m;

    .line 5
    iput p1, p0, Les/m9;->a:I

    add-int/lit8 v1, p2, 0xa

    .line 6
    iput v1, p0, Les/m9;->d:I

    .line 7
    iput p2, p0, Les/m9;->b:I

    .line 8
    iget v1, p0, Les/m9;->d:I

    new-array v1, v1, [Lcom/esfile/screen/recorder/media/util/l;

    iput-object v1, p0, Les/m9;->c:[Lcom/esfile/screen/recorder/media/util/l;

    if-lez p2, :cond_0

    :goto_0
    if-ge v0, p2, :cond_0

    .line 9
    iget-object v1, p0, Les/m9;->c:[Lcom/esfile/screen/recorder/media/util/l;

    invoke-direct {p0, p1}, Les/m9;->b(I)Lcom/esfile/screen/recorder/media/util/l;

    move-result-object v2

    aput-object v2, v1, v0

    add-int/lit8 v0, v0, 0x1

    goto :goto_0

    :cond_0
    return-void
.end method

.method private a()V
    .locals 4

    .line 23
    iget v0, p0, Les/m9;->e:I

    const/high16 v1, 0xa00000

    if-le v0, v1, :cond_1

    const/4 v0, 0x0

    const/4 v1, 0x0

    .line 24
    :goto_0
    iget v2, p0, Les/m9;->d:I

    if-ge v1, v2, :cond_0

    .line 25
    iget-object v2, p0, Les/m9;->c:[Lcom/esfile/screen/recorder/media/util/l;

    const/4 v3, 0x0

    aput-object v3, v2, v1

    add-int/lit8 v1, v1, 0x1

    goto :goto_0

    .line 26
    :cond_0
    iput v0, p0, Les/m9;->e:I

    .line 27
    iput v0, p0, Les/m9;->b:I

    .line 28
    invoke-static {}, Ljava/lang/System;->gc()V

    :cond_1
    return-void
.end method

.method private declared-synchronized a(Lcom/esfile/screen/recorder/media/util/l;)V
    .locals 6

    monitor-enter p0

    .line 12
    :try_start_0
    invoke-direct {p0}, Les/m9;->a()V

    .line 13
    iget-object v0, p1, Lcom/esfile/screen/recorder/media/util/l;->b:Ljava/nio/ByteBuffer;

    invoke-virtual {v0}, Ljava/nio/ByteBuffer;->clear()Ljava/nio/Buffer;

    const/4 v0, -0x1

    const v1, 0x7fffffff

    const/4 v2, 0x0

    const/4 v3, 0x0

    .line 14
    :goto_0
    iget v4, p0, Les/m9;->d:I

    if-ge v3, v4, :cond_2

    .line 15
    iget-object v4, p0, Les/m9;->c:[Lcom/esfile/screen/recorder/media/util/l;

    aget-object v4, v4, v3

    if-nez v4, :cond_0

    .line 16
    iget v0, p0, Les/m9;->b:I

    add-int/lit8 v0, v0, 0x1

    iput v0, p0, Les/m9;->b:I

    move v0, v3

    goto :goto_1

    .line 17
    :cond_0
    iget-object v5, v4, Lcom/esfile/screen/recorder/media/util/l;->b:Ljava/nio/ByteBuffer;

    invoke-virtual {v5}, Ljava/nio/ByteBuffer;->capacity()I

    move-result v5

    if-ge v5, v1, :cond_1

    .line 18
    iget-object v0, v4, Lcom/esfile/screen/recorder/media/util/l;->b:Ljava/nio/ByteBuffer;

    invoke-virtual {v0}, Ljava/nio/ByteBuffer;->capacity()I

    move-result v0

    move v1, v0

    move v0, v3

    :cond_1
    add-int/lit8 v3, v3, 0x1

    goto :goto_0

    :cond_2
    move v2, v1

    .line 19
    :goto_1
    iget-object v1, p1, Lcom/esfile/screen/recorder/media/util/l;->b:Ljava/nio/ByteBuffer;

    invoke-virtual {v1}, Ljava/nio/ByteBuffer;->capacity()I

    move-result v1

    if-ltz v0, :cond_3

    if-ge v2, v1, :cond_3

    .line 20
    iget-object v3, p0, Les/m9;->c:[Lcom/esfile/screen/recorder/media/util/l;

    aput-object p1, v3, v0

    .line 21
    iget p1, p0, Les/m9;->e:I

    sub-int/2addr v1, v2

    add-int/2addr p1, v1

    iput p1, p0, Les/m9;->e:I
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    .line 22
    :cond_3
    monitor-exit p0

    return-void

    :catchall_0
    move-exception p1

    monitor-exit p0

    goto :goto_3

    :goto_2
    throw p1

    :goto_3
    goto :goto_2
.end method

.method static synthetic a(Les/m9;Lcom/esfile/screen/recorder/media/util/l;)V
    .locals 0

    .line 1
    invoke-direct {p0, p1}, Les/m9;->a(Lcom/esfile/screen/recorder/media/util/l;)V

    return-void
.end method

.method private b(I)Lcom/esfile/screen/recorder/media/util/l;
    .locals 3

    .line 1
    new-instance v0, Lcom/esfile/screen/recorder/media/util/l;

    iget-object v1, p0, Les/m9;->f:Lcom/esfile/screen/recorder/media/util/m;

    invoke-static {p1}, Ljava/nio/ByteBuffer;->allocateDirect(I)Ljava/nio/ByteBuffer;

    move-result-object p1

    new-instance v2, Landroid/media/MediaCodec$BufferInfo;

    invoke-direct {v2}, Landroid/media/MediaCodec$BufferInfo;-><init>()V

    invoke-direct {v0, v1, p1, v2}, Lcom/esfile/screen/recorder/media/util/l;-><init>(Lcom/esfile/screen/recorder/media/util/m;Ljava/nio/ByteBuffer;Landroid/media/MediaCodec$BufferInfo;)V

    return-object v0
.end method


# virtual methods
.method public declared-synchronized a(I)Lcom/esfile/screen/recorder/media/util/l;
    .locals 4

    monitor-enter p0

    .line 2
    :try_start_0
    iget v0, p0, Les/m9;->b:I

    if-lez v0, :cond_2

    const v0, 0x7fffffff

    const/4 v1, -0x1

    const/4 v2, 0x0

    .line 3
    :goto_0
    iget v3, p0, Les/m9;->d:I

    if-ge v2, v3, :cond_1

    .line 4
    iget-object v3, p0, Les/m9;->c:[Lcom/esfile/screen/recorder/media/util/l;

    aget-object v3, v3, v2

    if-eqz v3, :cond_0

    iget-object v3, p0, Les/m9;->c:[Lcom/esfile/screen/recorder/media/util/l;

    aget-object v3, v3, v2

    iget-object v3, v3, Lcom/esfile/screen/recorder/media/util/l;->b:Ljava/nio/ByteBuffer;

    .line 5
    invoke-virtual {v3}, Ljava/nio/ByteBuffer;->capacity()I

    move-result v3

    sub-int/2addr v3, p1

    if-ltz v3, :cond_0

    if-ge v3, v0, :cond_0

    move v1, v2

    move v0, v3

    :cond_0
    add-int/lit8 v2, v2, 0x1

    goto :goto_0

    :cond_1
    if-ltz v1, :cond_2

    .line 6
    iget-object p1, p0, Les/m9;->c:[Lcom/esfile/screen/recorder/media/util/l;

    aget-object p1, p1, v1

    .line 7
    iget-object v0, p0, Les/m9;->c:[Lcom/esfile/screen/recorder/media/util/l;

    const/4 v2, 0x0

    aput-object v2, v0, v1

    .line 8
    iget v0, p0, Les/m9;->b:I

    add-int/lit8 v0, v0, -0x1

    iput v0, p0, Les/m9;->b:I

    .line 9
    iget v0, p0, Les/m9;->e:I

    iget-object v1, p1, Lcom/esfile/screen/recorder/media/util/l;->b:Ljava/nio/ByteBuffer;

    invoke-virtual {v1}, Ljava/nio/ByteBuffer;->capacity()I

    move-result v1

    sub-int/2addr v0, v1

    iput v0, p0, Les/m9;->e:I
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    .line 10
    monitor-exit p0

    return-object p1

    .line 11
    :cond_2
    :try_start_1
    iget v0, p0, Les/m9;->a:I

    if-le p1, v0, :cond_3

    goto :goto_1

    :cond_3
    iget p1, p0, Les/m9;->a:I

    :goto_1
    invoke-direct {p0, p1}, Les/m9;->b(I)Lcom/esfile/screen/recorder/media/util/l;

    move-result-object p1
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    monitor-exit p0

    return-object p1

    :catchall_0
    move-exception p1

    monitor-exit p0

    goto :goto_3

    :goto_2
    throw p1

    :goto_3
    goto :goto_2
.end method
